package com.ruoyi.xuexiao.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.ruoyi.common.mybatis.MyBatisUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.xuexiao.domain.entity.KsOsgb;
import com.ruoyi.xuexiao.domain.param.KsOsgbPageParam;
import com.ruoyi.xuexiao.domain.vo.KsOsgbPageVo;
import com.ruoyi.xuexiao.mapper.KsOsgbMapper;
import com.ruoyi.xuexiao.service.KsOsgbService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * 倾斜影像Service实现层
 *
 * @author: Gao Tianle
 * @date: 2024-05-27 10:24
 **/
@Service
@Transactional(rollbackFor = Exception.class)
public class KsOsgbServiceImpl extends ServiceImpl<KsOsgbMapper, KsOsgb> implements KsOsgbService {

    /**
     * 倾斜影像分页查询
     *
     * @param param 倾斜影像分页查询条件
     * @return
     * @author Gao Tianle
     * @date 2024/5/27 10:37
     */
    @Override
    public IPage<KsOsgbPageVo> ksOsgbPage(KsOsgbPageParam param) {
        //构建分页查询条件
        MPJLambdaWrapper<KsOsgb> wrapper = new MPJLambdaWrapper<KsOsgb>()
                //许可证号查询条件
                .like(StringUtils.isNotEmpty(param.getXkzh()), KsOsgb::getXkzh, param.getXkzh())
                //名称查询条件
                .like(StringUtils.isNotEmpty(param.getMc()), KsOsgb::getMc, param.getMc());
        //查询分页数据
        Page<KsOsgbPageVo> ksOsgbPageVoPage = getBaseMapper().selectJoinPage(MyBatisUtils.buildPage(param), KsOsgbPageVo.class, wrapper);
        return ksOsgbPageVoPage;
    }
}
